package com.pcbly.web.components.license.validator;

import com.pcbly.web.components.license.License;
import com.pcbly.web.components.license.LicenseException;

public class NameValidator implements Validator {

	public NameValidator(String name) {
		this.name = name;
	}

	public void validate(License license) throws LicenseException {
		if (!name.equals(license.getLicenseData().getName()))
			throw new LicenseException((new StringBuilder()).append(
					"License must be for ").append(name).append(" not ")
					.append(license.getLicenseData().getName()).toString());
		else
			return;
	}

	private final String name;

}
